<?php
namespace app\admin\controller;
use think\Controller;

class Controtime extends controller{
	function setopenplate(){
		// 脚本控制开封盘
		$res = model('openplate')->findall();
		foreach ($res as $key => $v) {
			if(time()>=$v['opentime'] && time()<=$v['tclosetime']){
				model('openplate')->where('id',$v['id'])->update(['type'=>1]);
			}else if(time()>=$v['opentime'] && time()<=$v['zclosetime']){
				model('openplate')->where('id',$v['id'])->update(['status'=>1]);
			}else{
				model('openplate')->where('id',$v['id'])->update(['status'=>0,'type'=>0]);
			}
		}
	}
}